<template>
    <div>
        <el-table :data="tableData" style="width: 100%">
            <!-- <el-table-column prop="date" label="日期" /> -->
            <el-table-column v-for="(item,keyVal, i) of headers" :key="i"  :label="item">
                <template v-if="item!='操作'" #default="scope">
                    <div>{{ scope.row[keyVal] }}</div>
                </template>
                <template v-else #default="scope">
                    <div>{{ obj }}</div>
                    <el-button @click="obj = scope.row">编辑</el-button>
                    <el-button @click="del(scope.row)" type="danger">删除</el-button>
                </template>
            </el-table-column>
        </el-table>
    </div>
</template>

<script setup lang="ts">
import { ref } from "vue";
defineProps(["tableData", "headers"])

let obj = ref(20);
// let edit = (row:any)=>{
//     console.log(row);
// }

defineExpose({
    obj
})

</script>

<style scoped></style>